﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Scala.Data.Impl.Uow
{
    public class UnitOfWorkFactory : IUnitOfWorkFactory
    {
        private IConfigurator configurator;

        public UnitOfWorkFactory(IConfigurator configurator)
        {
            if (configurator == null) throw new NullReferenceException("configurator");
            this.configurator = configurator;
        }

        #region IUnitOfWorkFactory Members

        public IUnitOfWork Create()
        {
            return new UnitOfWork(configurator.SessionFactory.OpenSession(), IsolationLevel.ReadCommitted);
        }

        #endregion
    }
}
